package Client;

import java.applet.Applet;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import Protocol.Package;

import Protocol.Command;

public class Main {
	public static void main(String args[]) {
		Socket socket;
		try {
			String localhost = "172.17.17.71";
			System.out.println(localhost);
			socket = new Socket(localhost, 8999);

			BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
					socket.getOutputStream()));
			Package pkg = new Package(localhost, "roll", "1");
			String send = Command.generate(pkg);
			out.write(send);
			out.flush();

			BufferedReader reader = new BufferedReader(new InputStreamReader(
					socket.getInputStream()));
			System.out.println(reader.readLine());

		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		// while(true){
		// byte[] test = new byte[120];
		// in.read(test);
		// System.out.println(test.toString());
		// }

	}
}
